package com.shopmall.service;

import com.shopmall.mapper.GoodsInListMapper;
import com.shopmall.pojo.GoodsInList;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class GoodsInListServiceImpl implements GoodsInListService{  //这个implements可不能忘记！！！

    @Autowired
    GoodsInListMapper goodsInListMapper;

    @Override
    public List<GoodsInList> queryGoodsInListList(){
        return goodsInListMapper.queryGoodsInListList();
    }

    @Override
    public List<GoodsInList> queryGoodsInListByGoodsName(String goods_name){
        return goodsInListMapper.queryGoodsInListByGoodsName(goods_name);
    }

    @Override
    public int addGoodsInList(GoodsInList goodsInList){
        return goodsInListMapper.addGoodsInList(goodsInList);
    }

    @Override
    public int updateGoodsInList(GoodsInList goodsInList) {//mybatis中的update 和其他 数据库操作不一样哦，id直接以对象中属性传进修改了
        //而对象的id属性，并不允许修改的
        return goodsInListMapper.updateGoodsInList(goodsInList);
    }

    @Override
    public int deleteGoodsInList(int id){
        return goodsInListMapper.deleteGoodsInList(id);
    }

}
